<template>
  <Layout :gradient = "true">
    <Header>
      <Close @click="handleBack" slot='left' />
    </Header>
    <Content>
      <div class="logo"></div>
      <form @submit="handleSubmit">
        <div class="form-group">
          <Icon type = 'denglu-copy' />
          <div class="form-control-wrap">
            <input
              type="text"
              class="form-control"
              autocomplete="off"
              placeholder="护理栈通行证（手机号/邮箱）"
              @focus="handleFocus"
              @blur="handleBlur"
              v-model="username"
            />
          </div>
        </div>
        <div class="form-group">
          <Icon type = 'mima' />
          <div class="form-control-wrap">
            <input
              type="password"
              class="form-control"
              autocomplete="off"
              placeholder="请输入密码"
              @focus="handleFocus"
              @blur="handleBlur"
              v-model="password"
            />
          </div>
        </div>
        <button type='submit' class="submit">登录</button>
        <div class="form-action">
          <a>新用户注册</a>
          <a>忘记密码？</a>
        </div>
      </form>
    </Content>
    <Footer v-if='visibleFooter'>
      <div class="bottom-text"><i></i><span>护理栈会议服务平台</span><i></i></div>      
    </Footer>
  </Layout>
</template>

<script>

import Layout from '@/component/layout/index.js'
import Close from '@/component/close/index.vue'
import Icon from '@/component/icon/index.vue'

const {
  Header,
  Content,
  Footer
} = Layout

export default {

  name: 'index',

  data () {
    return {
      username: '',
      password: '',

      // 当输入框焦点的时候隐藏底部
      visibleFooter: true
    }
  },

  methods: {
    handleBack: function (e) {
      this.$router.go(-1)
    },
    handleFocus: function (e) {
      this.visibleFooter = false
    },
    handleBlur: function (e) {
      this.visibleFooter = true
    },
    handleSubmit: function (e) {
      e.preventDefault()
    },
  },

  components: {
    Layout,
    Header,
    Content,
    Footer,
    Close,
    Icon,
  },
}

</script>

<style lang="less" scoped>

@import '../../less/mixin.less';

.logo {
  width: 86px;
  height: 86px;
  border-radius: 43px;
  background:url('../../asset/img/logo.png') no-repeat center center;
  background-size: contain;
  margin: 42px auto;
}

form {
  padding: 0 40px;
  margin: 50px 0;
}

.form-group {
  padding: 10px 0;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,.5);

  &:last-child {
    margin-bottom: 0;
  }

  > i {
    color: #fff;
    font-size: 20px;
    margin-right: 11px;
    flex-shrink: 0;
    opacity: .8;
  }
}

.form-control-wrap {
  flex-grow: 1;
}

.form-control {
  display: block;
  width: 100%;
  border: none;
  font-size: 15px;
  height: 24px;
  background: transparent;
  -webkit-appearance: none;
  outline: 0;
  color: #fff;

  .resetPlaceholder(rgba(255,255,255,.5));
}

.submit {
  margin: 30px 0 10px;
  display: block;
  width: 100%;
  border-radius: 4px;
  border: 1px solid #FBAC07;
  color: #fff;
  background-color: #FBAC07;
  text-align: center;
  font-size: 20px;
  font-weight: 400;
  height: 38px;
  line-height: 36px;
  letter-spacing: .4em;
}

.form-action {
  display: flex;
  justify-content: space-between;

  a {
    color: #fff;
    font-size: 13px;
  }
}

</style>